package com.liruo.test.spring.annotationdep.bean.condidtion;

import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.annotation.MergedAnnotations;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

import java.util.Arrays;

/**
 * @Author:liruo
 * @Date:2022-11-20-19:55:28
 * @Desc
 */
public class Win64Condition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        String os = context.getEnvironment().getProperty("os.name");
        if(os != null && os.contains("win64")){
            System.out.println("has win64 environment");
            return true;
        }
        return false;
    }
}
